home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / samples / dmhgeneral.tex < prev    next >
Encoding:
Text File  |  1989-11-22  |  7.8 KB  |  217 lines

  1. %
  2. %  Automatic numberer: \EQ for regular equations, \EQQ for several
  3. %    numbered equations in \eqalign sequence.
  4. %  Format of the equation label is (c.e), right justified,
  5. %    where 'c' is the chapter number \Chapno 
  6. %    and 'e' the equation number \Eqno. You should set \Chapno at the
  7. %    beginning of the file.
  8. \newcount\Eqno
  9. \Eqno=0
  10. \def \EQ   {\global\advance\Eqno by 1\eqno{(\number\Chapno .\number\Eqno)}}
  11. \def \EQQ  {\global\advance\Eqno by 1 &{ (\number\Chapno.\number\Eqno)}}
  12. %
  13. %  Examples:
  14. %
  15. %  $$ x = 3 + i \EQ$$
  16. %  $$ \eqalign {x & = 30 \EQQ \cr
  17. %               y & = 50 \EQQ \cr} $$
  18. %
  19. %
  20. %  Retrieval of an equation number: save it in a box.
  21. %  After display mode, say "\key `number' `space'". Then to retrieve 
  22. %    the words "Eq. c.e" do "\copy `number'" or "\box `number'" if you
  23. %    only need to remember it once. The dummy `number' can be any number
  24. %    from 0 to 150, it is not the same as \Eqno. YOU must remember how
  25. %    you keyed a particular equation. The key remains the same, even if
  26. %    you change the order of the equations.
  27. %
  28. \def \key #1 {\setbox#1=\hbox{Eq. \number\Chapno .\number\Eqno}}
  29. %
  30. %  Example: $$ x = y + z \EQ$$ \key71
  31. %           \par As seen above in \copy71, this is a very blah, ...
  32. %
  33. %
  34. %        FIGURES
  35. %
  36. \newcount\Figno
  37. \newcount\FIGNO
  38. \newcount\Figpgno
  39. %
  40. %  Make a numbered page that is blank except for "Figure c.f" at the bottom.
  41. %
  42. \def \figpage {\par \null \vfill \par \centerline {Figure \number \Chapno 
  43.            \global \advance \Figpgno by1.\number\Figpgno}\eject}
  44. %
  45. %  Refer to a new figure in the text for the first time.
  46. %
  47. \def \Fig {\global \advance \Figno by1 Figure~\number
  48.            \Chapno .\number\Figno}
  49. %
  50. %  The figure caption always follows \FIG.
  51. %
  52. \def \FIG {\par \noindent \global \advance \FIGNO by1 {\bf FIG. \number
  53.               \Chapno .\number \FIGNO}: }
  54. %
  55. %  Refer to more than one figure in the text for the first time.
  56. %  ... as seen in Figures 5.3-6 ...
  57. %  (I am not sure this works.)
  58. %
  59. \def \Figs #1{{\advance\Figno by1 Figures \number\Chapno
  60.          .\number\Figno}$-$ \global\advance\Figno by#1\number\Figno}
  61. %
  62. %       TABLES
  63. %
  64. \newcount\Tablno
  65. \newcount\rno
  66. %
  67. %  Start each single table out with \Table.
  68. %
  69. \def \Table  {\global \advance \Tablno by1\par \noindent 
  70.              {\bf Table \number\Chapno-\number\Tablno}: }
  71. %
  72. %       Tables a, b, c: There is a separate macro for the first one,
  73. %       \Tablea. For all subsequent tables use \Tableb. It uses the 
  74. %       same table number as the previous table. 
  75. %
  76. \def \Tablea {\global \advance \Tablno by1\par \noindent 
  77.              {\bf Table \number\Chapno-\number\Tablno a}: }
  78. \def \Tableb #1:{\par \noindent 
  79.              {\bf Table \number\Chapno-\number\Tablno #1}: }
  80. %
  81. %  Refer to a table for the first time in the text. \TABLE
  82. %  ... Table c--n ...
  83. %
  84. \def \TABLE {\global \advance \Tablno by1Table~\number \Chapno --\number
  85.              \Tablno} 
  86. %
  87. %  Use \skiptable to skip over a sideways table, but keep numbering correct.
  88. %  It also leaves a single blank, numbered page.
  89. %
  90. \def \skiptable {\global \advance \Tablno by1\null \eject}
  91. %
  92. %  Make two lines across, slightly separated. 
  93. %
  94. \def \linet {\smallskip \hrule \nobreak \smallskip \hrule \smallskip}
  95. %
  96. %     CHAPTERS
  97. %
  98. \newcount\Chapno
  99. \Chapno=0
  100. %
  101. %  To start a new chapter: \Chapno should be set at zero for the first 
  102. %    chapter, one for chapter 2, etc. because \Chap increments \Chapno.
  103. %    It also initializes the figure, table, and reference counters.
  104. %
  105. \def \Chap #1{\global \Eqno=0\global \rno=0
  106.    \global \Figno=0
  107.    \global \FIGNO=0
  108.    \global \Figpgno=0
  109.    \global \Tablno=0
  110.    \global \advance \Chapno by1\null \vskip 1in 
  111.    \global \Tablno=0\global \Figno=0\global \rno=0
  112.    \line {\bf CHAPTER \number \Chapno \hfil}
  113.    \bigskip
  114.    \line {\bf #1\hfil} \vskip2pc}
  115. %
  116. %        SECTIONS
  117. %
  118. %   Follow \sect with the section label and title. These macros are NOT
  119. %     automatic numberers.
  120. %
  121. \def \sect #1{\vskip20pt \par\noindent{\bf #1}\vskip10pt\nobreak\par\nobreak}
  122. \def \subsect #1{\vskip10pt \par\noindent{\bf #1}\vskip10pt\nobreak\par\nobreak}
  123. %
  124. %        REFERENCES
  125. %
  126. %   \genref
  127. %   General references - for cases that don't fit into the special macros 
  128. %     defined below, there is always this one.
  129. %
  130. %   Note the format of the argument list. This is very important. The argument
  131. %     comes after a left parenthesis, and before a right parenthesis that is
  132. %     immediately followed by a blank space. A right parenthesis followed by 
  133. %     a carriage return will not do.
  134. %
  135. \def \genref (#1) {{\global\advance\rno by1{}$^{\number\rno}$
  136.          \advance\rno by 150\global \setbox\number\rno =\vtop
  137.          {\advance\rno by -150\item{\number\rno. }{\rm #1}.}}}
  138. %
  139. %  \ref
  140. %  Regular references. (Multiple authors; one journal; volume; page; year) 
  141. %
  142. \def \ref (#1;#2;#3;#4;#5) {\genref ({{\rm #1}, {\sl #2}, {\bf #3}, 
  143. {\rm #4 (#5)}}) }
  144. %
  145. %  book references - underlines the title
  146. %  \refb (author; title; publisher; city(optionally, state); year; misc) 
  147. %
  148. %  The title is in math mode so one has to put the spaces between words 
  149. %    in with "\ " or smaller ones with "\,"
  150. \def \refb (#1;#2;#3;#4;#5;#6) {{\global\advance\rno by1{}$^{\number\rno}$
  151.        \advance\rno by 150\global \setbox\number\rno =\vtop
  152.        {\advance\rno by -150\item{\number\rno. }{\rm #1}, 
  153.        $\underline{\rm #2}$, (#3, #4, #5) \rm #6.}}}
  154. %
  155. %  In a book references - underlined
  156. %  This is for when the person quoted only wrote a part of a book.
  157. %
  158. \def \refi (#1;#2;#3;#4;#5;#6;#7;#8) {{\global\advance\rno by1{}$^{\number\rno}$
  159.     \advance\rno by 150\global \setbox\number\rno =\vtop
  160.     {\advance\rno by -150\item{\number\rno. }{\rm #1, in:}
  161.     $\underline{\rm #2}$, Vol. #3, ed. #4 (#5, #6, #7), #8.}}}
  162. %
  163. % in a book references - italicized. It is easier to italicize than underline,
  164. %   especially when the title is very long.
  165. %
  166. \def \refit(#1;#2;#3;#4;#5;#6;#7;#8){{\global\advance\rno by1{}$^{\number\rno}$
  167.     \advance\rno by 150\global \setbox\number\rno =\vtop
  168.     {\advance\rno by -150\item{\number\rno. }{\rm #1, in:}
  169.     {\it #2}, Vol. #3, ed. #4 (#5, #6, #7), #8.}}}
  170. %
  171. %  comma references - When two papers are referenced at the same time, this
  172. %    will put a comma before the second number in the superscript.
  173. %
  174. \def \refc (#1;#2;#3;#4;#5) {{\global\advance\rno by1$\! \!^{,\number\rno}$
  175.    \advance\rno by 150\global \setbox\number\rno =\vtop
  176.    {\advance\rno by -150\item{\number\rno. }{\rm #1}, {\sl 
  177.    #2}, {\bf #3}, {\rm #4 (#5)}.}}}
  178. %
  179. %  Several references, a, b, c. Use with \genref.
  180. %  Example (using _ to point out the required space bars): 
  181. %       "\genref (\refabc (a)(author1;journal1;vol1;page1;year1)_;_ 
  182. %            \refabc (b)(author2;journal2;vol2;page2;year2)_)_"
  183. %
  184. %  It is good to put the semicolon in between reference (a) and (b).
  185. %  This can't be part of the macro because then the reference would 
  186. %    end with a semicolon.
  187. %
  188. \def \refabc (#1)(#2;#3;#4;#5;#6) {{\rm #1) #2}, {\sl #3}, {\bf #4}, 
  189.                {\rm #5 (#6)}}
  190. %
  191. % 2 part Multi-referencer
  192. %
  193. %  Refer to a group of papers in the text, with a hyphen in between, 
  194. %    as in 18-22.  \multiref does not store the references at the end.
  195. %    One needs to use \genrefnoi, in general, or \refbox, for simple
  196. %    cases, for that.
  197. %
  198. \def\multiref #1{{\advance \rno by1{}$^{\number \rno 
  199.                 -{\advance \rno by#1\number\rno}}$}}
  200. %
  201. %  \refbox 
  202. %  This will put a reference in the list at the end without having 
  203. %    to refer to it in the text. This is useful if you have references in
  204. %    tables.
  205. %
  206. \def \refbox (#1;#2;#3;#4;#5) {\genrefnoi ({{\rm #1}, {\sl #2}, {\bf #3}, 
  207.      {\rm #4 (#5)}}) }
  208. %
  209. % \genrefnoi does not put a superscript in the text. This is useful if
  210. %   you need references in the list, but you refer to them in some outside
  211. %   part, such as a table.
  212. %
  213. \def\genrefnoi (#1) {{\global \advance \rno by 1 \advance \rno by 
  214.                150\global \setbox \number \rno=\vtop {\advance 
  215.                \rno by -150\item {\number \rno. }{\rm #1}.}}}
  216.